
<style>
    .fixed-table-pagination .pagination-detail, .fixed-table-pagination div.pagination {
        margin-top: 0px;
        margin-bottom: 0px;
    }
</style>

<div class="container-fluid">
    <div class="row">
        <div class="panel panel-default" style="margin-bottom: 0px;">
            <div class="panel-heading" style="font-weight: bold">
                <span>教育资源产出指标</span>
            </div>
            <div class="panel-body">
                <div id="toolbar" style="margin-bottom: 5px;">
                    <div class="form-inline">
                        <input id="search" class="form-control" placeholder="学院" onkeyup="rateOut.refreshTable()" style="width: 120px">
                        <button class="btn btn-primary btn-sm" onclick="rateOut.clickAdd()">新增</button>
                        <button class="btn btn-danger btn-sm" onclick="rateOut.clickDeleteAll()">批量删除</button>
                        <button class="btn btn-success btn-sm" onclick="importExcel()">导入Excel</button>
                        <button class="btn btn-success btn-sm" onclick="rateOut.exportExcel()">导出Excel</button>
                    </div>
                </div>
                <table id="list-table"></table>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        var h = $(window).height();
        $("#list-table").bootstrapTable({
            url:'getRateOutList',
            method:'post',
            sidePagination: 'server',
            pagination:true,
            pageSize:20,
            pageList:[10,20,50],
            pageNumber:1,
            height:h - 210,
            columns:[
                [
                    {
                        checkbox:true
                        ,rowspan:3
                    },
                    {
                        title:'学院'
                        ,rowspan:3
                        ,field:'SHORTNAME'
                        ,sortKey:'COLLEGE_ID'
                        ,sortable:true
                    }
                    ,{
                        title:'人才培养'
                        ,colspan:13
                        ,align:'center'
                    }
                    ,{
                        title:'科学研究'
                        ,colspan:6
                        ,align:'center'
                    }
                    ,{
                        title:'社会服务'
                        ,colspan:5
                        ,align:'center'
                    }
                    ,{
                        title:'操作'
                        ,rowspan:3
                        ,field:'R_OUT_ID'
                        ,halign:'center'
                        ,align:'center'
                        ,formatter:eval('rateOut.listButton')
                    }
                ]
                ,[
                    {
                        title:'人才培养规模',
                        colspan:3
                        ,align:'center'
                    }
                    ,{
                        title:'人才培养质量',
                        colspan:10
                        ,align:'center'
                    }
                    ,{
                        title:'著作',
                        colspan:1
                        ,align:'center'
                    }
                    ,{
                        title:'收录论文',
                        colspan:1
                        ,align:'center'
                    }
                    ,{
                        title:'论文质量',
                        colspan:2
                        ,align:'center'
                    }
                    ,{
                        title:'科研获奖',
                        colspan:2
                        ,align:'center'
                    }
                    ,{
                        title:'社会服务收入',
                        colspan:5
                        ,align:'center'
                    }
                ]
                ,[
                    {
                        title:'在校生总数',
                        field:'PT_NUM_ZX'
                        ,sortable:true

                    }
                    ,{
                        title:'博士生人数比例',
                        field:'PT_RATE_BS'
                        ,sortable:true
                    }
                    ,{
                        title:'毕业生总数'
                        ,field:'PT_NUM_BY'
                        ,sortable:true
                    }
                    ,{
                        title:'学生竞赛获奖数'
                        ,field:'PT_NUM_JS'
                        ,sortable:true
                    }
                    ,{
                        title:'优秀博士论文数'
                        ,field:'PT_NUM_YB'
                        ,sortable:true
                    }
                    ,{
                        title:'优秀硕士论文数'
                        ,field:'PT_NUM_YS'
                        ,sortable:true
                    }
                    ,{
                        title:'初始就业率'
                        ,field:'PT_RATE_JY'
                        ,sortable:true
                    }
                    ,{
                        title:'本科生读研比例'
                        ,field:'PT_RATE_DY'
                        ,sortable:true
                    }
                    ,{
                        title:'出国留学率'
                        ,field:'PT_RATE_OUT'
                        ,sortable:true
                    }
                    ,{
                        title:'出国交流学生人数比例'
                        ,field:'PT_RATE_OUT_JL'
                        ,sortable:true
                    }
                    ,{
                        title:'在站博士后人数'
                        ,field:'PT_NUM_BSH'
                        ,sortable:true
                    }
                    ,{
                        title:'国家级优秀教学成果奖数'
                        ,field:'PT_NUM_GJ'
                        ,sortable:true
                    }
                    ,{
                        title:'省级优秀教学成果奖数'
                        ,field:'PT_NUM_SJ'
                        ,sortable:true
                    }
                    ,{
                        title:'学术或科技（社科）著作数'
                        ,field:'KX_NUM_ZZ'
                        ,sortable:true
                    }
                    ,{
                        title:'SCI、EI、SSCI、CPCI-S、CSSCI论文数'
                        ,field:'KX_NUM_LW'
                        ,sortable:true
                    }
                    ,{
                        title:'Science&Nature上发表的论文数'
                        ,field:'KX_NUM_SN'
                        ,sortable:true
                    }
                    ,{
                        title:'SCI学科影响因子前1/10的期刊发表论文数'
                        ,field:'KX_NUM_SCI'
                        ,sortable:true
                    }
                    ,{
                        title:'国家级奖励数'
                        ,field:'KX_NUM_GJ'
                        ,sortable:true
                    }
                    ,{
                        title:'省部级奖励数'
                        ,field:'KX_NUM_SB'
                        ,sortable:true
                    }
                    ,{
                        title:'横向科研经费输入'
                        ,field:'SH_FEE_HX'
                        ,sortable:true
                    }
                    ,{
                        title:'专利、技术转让/许可收入'
                        ,field:'SH_FEE_ZL'
                        ,sortable:true
                    }
                    ,{
                        title:'信息咨询服务收入'
                        ,field:'SH_FEE_XX'
                        ,sortable:true
                    }
                    ,{
                        title:'非学历教育收入'
                        ,field:'SH_FEE_XL'
                        ,sortable:true
                    }
                    ,{
                        title:'实验室、大型仪器共享收入'
                        ,field:'SH_FEE_SB'
                        ,sortable:true
                    }
                ]
            ],
            queryParams:function (params) {
                params.search = $("#search").val();
                return params;
            },
            responseHandler:function (res) {
                console.log(res)
                return res;
            }
        });
    });
    
    var rateOut = {
        listButton: function (value, rowData, index) {
            var html1 = "<button class='btn btn-xs btn-default' R_OUT_ID='" + value + "' onclick='rateOut.clickEdit(this)' style='margin: 2px;'>查看</button>";
            return html1;
        }
        ,clickEdit:function (obj) {
            var rateOutId = $(obj).attr('R_OUT_ID');
            console.log(rateOutId);
            var h = $(window).height()*0.9;
            var w = $(window).width()*0.9;
            layer.open({
                title:'查看教育资源投入指标',
                area:[w + 'px', h + 'px'],
                type:2,
                content:"{:url('editRateOutPage')}?rateOutId=" + rateOutId
            });
        }
        ,exportExcel:function () {
            window.open("{:url('exportRateOutExcel')}?search=" + $("#search").val());
        }
        ,clickAdd:function () {
            var h = $(window).height()*0.9;
            var w = $(window).width()*0.9;

            layer.open({
                title:'新增教育资源产出指标',
                area:[w + 'px', h + 'px'],
                type:2,
                content:"{:url('addRateOutPage')}"
            });
        }
        ,clickDeleteAll:function () {
            var list = $("#list-table").bootstrapTable("getSelections");
            if(list.length < 1){
                layer.alert('请勾选要删除的教育资源产出指标',{icon:2});
                return;
            }

            var idList = [];
            for(var i = 0 ; i < list.length ; i++){
                idList.push(list[i]['R_OUT_ID']);
            }

            layer.confirm('确认删除选中的教育资源产出指标吗？',{icon:3},function (index) {
                layer.close(index);
                layer.load();
                $.ajax({
                    url:"{:url('deleteRateOutAll')}",
                    data:{list:idList},
                    success:function (res) {
                        layer.closeAll('loading');
                        var json = JSON.parse(res);
                        if(json['code'] == '200'){
                            layer.alert(json['msg'],{icon:1},function (index) {
                                layer.close(index);
                                rateOut.refreshTable();
                            });
                        }
                        else{
                            layer.alert(json['msg'],{icon:2});
                        }
                    },
                    error:function (res) {
                        layer.closeAll('loading');
                        layer.alert('网络错误',{icon:2});
                    }
                });
            });
        }
        ,refreshTable:function () {
            $("#list-table").bootstrapTable('refresh');
        }
    };


    function clickSearch() {
        var h = $(window).height()*0.8;
        var w = $(window).width()*0.8;
        if(w > 1200){
            w = 1200;
        }
        layer.open({
            title:'高级查询--请输入查询条件',
            area:[w + 'px', h + 'px'],
            type:2,
            content:"{:url('searchPage')}"
        });
    }

    function importExcel() {
        var h = $(window).height()*0.8;
        var w = $(window).width()*0.8;
        if(w > 1200){
            w = 1200;
        }
        layer.open({
            title:'导入',
            area:[w + 'px', h + 'px'],
            type:2,
            content:"{:url('rateOutImportPage')}",
            end:function () {
                rateOut.refreshTable();
            }
        });
    }

</script>